import 'package:equatable/equatable.dart';
import 'package:backend.core/core/domain/entities/api/google_play/api_google_play_purchased_subscription_price_change_status.dart';

const kApiGooglePlayPurchasedSubscriptionAbsentPriceChangeStatusValue = 'absent';
const kApiGooglePlayPurchasedSubscriptionAcceptedPriceChangeStatusValue = 'accepted';
const kApiGooglePlayPurchasedSubscriptionPendingPriceChangeStatusValue = 'pending';

class ApiGooglePlayPurchasedSubscriptionPriceChangeStatusDto extends Equatable {
  const ApiGooglePlayPurchasedSubscriptionPriceChangeStatusDto._internal({
    required this.priceChangeStatusString,
  });

  final String priceChangeStatusString;

  @override
  List<Object?> get props {
    return [
      priceChangeStatusString,
    ];
  }

  factory ApiGooglePlayPurchasedSubscriptionPriceChangeStatusDto.fromEntity(
      ApiGooglePlayPurchasedSubscriptionPriceChangeStatus priceChangeStatus) {
    late final String priceChangeStatusString;

    if (priceChangeStatus == ApiGooglePlayPurchasedSubscriptionPriceChangeStatus.absent) {
      priceChangeStatusString = kApiGooglePlayPurchasedSubscriptionAbsentPriceChangeStatusValue;
    } else if (priceChangeStatus == ApiGooglePlayPurchasedSubscriptionPriceChangeStatus.accepted) {
      priceChangeStatusString = kApiGooglePlayPurchasedSubscriptionAcceptedPriceChangeStatusValue;
    } else if (priceChangeStatus == ApiGooglePlayPurchasedSubscriptionPriceChangeStatus.pending) {
      priceChangeStatusString = kApiGooglePlayPurchasedSubscriptionPendingPriceChangeStatusValue;
    }

    return ApiGooglePlayPurchasedSubscriptionPriceChangeStatusDto._internal(
      priceChangeStatusString: priceChangeStatusString,
    );
  }

  @override
  String toString() {
    return priceChangeStatusString;
  }
}
